package com.limingfeiyu.platform.management.entity;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author :   LiMingFeiYu
 * @Date :   2024-03-10 18:37
 * @Explain: NewLoginUser
 */
public class NewLoginUser {

    private static List<LoginUser> loginUserListData = new ArrayList<>();

    static {

        LoginUser loginUser = new LoginUser();
        loginUser.setUserName("admin");
        loginUser.setPassword("123456");
        loginUser.setUserToken("admin-token");
        loginUser.setRoles("admin");
        loginUser.setIntroduction("I am a super administrator");
        loginUser.setAvatar("https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acfe.gif");
        loginUser.setAvatar("Super Admin");

        loginUserListData.add(loginUser);
        LoginUser loginUser1 = new LoginUser();
        loginUser1.setUserName("editor");
        loginUser1.setPassword("123456");
        loginUser1.setUserToken("editor-token");
        loginUser1.setRoles("editor");
        loginUser1.setIntroduction("I am a super editor");
        loginUser1.setAvatar("https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acfe.gif");
        loginUser1.setAvatar("Normal Editor");
         loginUserListData.add(loginUser1);

    }


    public static LoginUser getLoginUserByUserName(String userName) {
        LoginUser user = null;
        for (LoginUser loginuser : loginUserListData) {

            if (loginuser.getUserName().equals(userName.trim())) {
                user = loginuser;
                break;
            }
        }
        return user;
    }
}
